import request from '@/config/axios'

// 白名单操作 VO
export interface WhitelistOperateVO {
  id: number // ID
  startTime: Date // 开始时间
  endTime: Date // 截止时间
  status: number // 状态（0正常 1停用）
  remark: string // 备注
  learning: boolean // 备注
}

// 白名单操作 API
export const WhitelistOperateApi = {
  // 查询白名单操作分页
  getWhitelistOperatePage: async (params: any) => {
    return await request.get({ url: `/security/whitelist-operate/page`, params })
  },

  // 查询白名单操作详情
  getWhitelistOperate: async (id: number) => {
    return await request.get({ url: `/security/whitelist-operate/get?id=` + id })
  },

  // 新增白名单操作
  createWhitelistOperate: async (data: WhitelistOperateVO) => {
    return await request.post({ url: `/security/whitelist-operate/create`, data })
  },

  // 修改白名单操作
  updateWhitelistOperate: async (data: WhitelistOperateVO) => {
    return await request.put({ url: `/security/whitelist-operate/update`, data })
  },

  // 删除白名单操作
  deleteWhitelistOperate: async (id: number) => {
    return await request.delete({ url: `/security/whitelist-operate/delete?id=` + id })
  },

  // 导出白名单操作 Excel
  exportWhitelistOperate: async (params) => {
    return await request.download({ url: `/security/whitelist-operate/export-excel`, params })
  },

  // 开始
  startWhitelistOperate: async (data: WhitelistOperateVO) => {
    return await request.post({ url: `/security/whitelist-operate/start`, data })
  },

  // 停止
  stopWhitelistOperate: async (data: WhitelistOperateVO) => {
    return await request.post({ url: `/security/whitelist-operate/stop`, data })
  },

  getLatestWhitelistOperate: async () => {
    return await request.get({ url: `/security/whitelist-operate/detail`})
  },
}
